package com.wc._16届国特冲刺营._04动态规划_数位DP送分术.神奇数;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2025/5/8 11:32
 * @description
 * https://www.lanqiao.cn/courses/51805/learning/
 */
public class Main {
    /**
     * 思路：
     * 灵神的模板
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 210, M = 10, P = 998244353;
    // f[i][j] 表示遍历到第 i 位, 余数为 j 的个数
    static long[][] f = new long[N][M];
    static int[] nums = new int[N];
    static char[] l, r;
    static int n;

    public static void main(String[] args) {
        l = (" " + sc.next()).toCharArray();
        r = (" " + sc.next()).toCharArray();
        work(r);
        long res = 0;
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= n; j++) Arrays.fill(f[j], -1);
            res = (res + dfs(1, 0, i, true, false)) % P;
        }
        work(l);
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= n; j++) Arrays.fill(f[j], -1);
            res = ((res - dfs(1, 0, i, true, false)) % P + P) % P;
        }
        if (nums[n] != 0) {
            res += check();
        }
        res = (res % P + P) % P;
        out.println(res);
        out.flush();
    }

    static int check() {
        int sum = 0;
        for (int i = 1; i < n; i++) {
            sum += nums[i];
        }

        return sum % nums[n] == 0 ? 1 : 0;
    }

    static long dfs (int i, int j, int mod, boolean limit, boolean num) {
        if (i == n) {
            if (limit && num && mod <= nums[n] && j == 0) return 1;
            return !limit && num && j == 0 ? 1 : 0;
        }

        if (!limit && num && f[i][j] >= 0) return f[i][j];

        int up = limit ? nums[i] : 9;

        long res = 0;

        for (int k = 0; k <= up; k++) {
            res = (res + dfs(i + 1, (j + k) % mod, mod, limit && k == up, num || k != 0)) % P;
        }

        if (!limit && num) f[i][j] = res;

        return res;
    }

    static void work(char[] s) {
        n = s.length - 1;
        for (int i = 1; i <= n; i++) {
            nums[i] = s[i] - '0';
        }
    }
}


class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
